import * as req from '@/request';

export async function list(
  params: { [key: string]: any },
  sorter?: { [key: string]: any },
  filter?: { [key: string]: any },
) {
  return req.postForm<API.VpnServerMonitorList>(
    '/vpnserver/list',
    params,
    sorter,
    filter,
  );
}

export async function get(data: { [key: string]: any }) {
  return req.postForm<API.VpnServerModel>(
    '/vpnserver/get',
    data
  );
}

export async function getInfo(data: { [key: string]: any }) {
  return req.postForm<API.VpnServerInfoModel>(
    '/vpnserver/getInfo',
    data
  );
}

export async function add(data: { [key: string]: any }) {
  return req.postJson<API.Result>('/vpnserver/create', data);
}

export async function update(data: { [key: string]: any }) {
  return req.postJson<API.Result>('/vpnserver/update', data);
}

export async function remove(data: { key: string }) {
  return req.post<API.Result>('/vpnserver/delete', data);
}

export async function adds(data : {data: API.VpnServer[]}){
  return req.postJson<API.Result>('/vpnserver/creates',data);
}

// export async function status(data: {keys: string[], status: boolean}) {
//   return req.postForm<API.Result>('/vpnserver/status', data);
// }

export async function removes(data: {keys: string[]}){
  return req.postForm<API.Result>('/vpnserver/deletes',data);
}

// export async function groups(data: {keys: string[], groupIds: string[]}) {
//   return req.postForm<API.Result>('/vpnserver/groups', data);
// }

// export async function types(data: {keys: string[], type: number}) {
//   return req.postForm<API.Result>('/vpnserver/types', data);
// }

// export async function suppliers(data: {keys: string[], id: number}) {
//   return req.postForm<API.Result>('/vpnserver/suppliers', data);
// }

// export async function remarks(data: any) {
//   return req.postForm<API.Result>('/vpnserver/remarks', data);
// }

export async function batchChange(data: { [key: string]: any }) {
  return req.postForm<API.Result>('/vpnserver/batchchange', data);
}

// export async function updateIpByRemark(data: any) {
//   return req.postForm<API.Result>('/vpnserver/updateipbyremark', data);
// }

export async function removeInsts(data: {keys: number[]}) {
  return req.postForm<API.Result>('/vpnserver/DeleteByInsts', data);
}


export async function changeIpLogs(
  params?: { [key: string]: any },
  sorter?: { [key: string]: any },
  filter?: { [key: string]: any },
  ) {
  return req.postForm<API.VpnServerChangeIpLogList>('/vpnserver/ChangeIpLogs',
  params,
  sorter,
  filter,);
}


// export async function blockedIpList(
//   params?: { [key: string]: any },
//   sorter?: { [key: string]: any },
//   filter?: { [key: string]: any },
//   ) {
//   return req.postForm<API.VpnServerBlockedIpList>('/vpnserver/blockedIpList',
//   params,
//   sorter,
//   filter,);
// }

// export async function checkblockedIpList(data: {ips?: string}) {
//   return req.postForm<API.VpnServerBlockedIpList>('/vpnserver/checkblockedIpList', data);
// }


// export async function blockedIpStatList(
//   params?: { [key: string]: any },
//   sorter?: { [key: string]: any },
//   filter?: { [key: string]: any },
//   ) {
//   return req.postForm<API.VpnServerBlockedIpStatList>('/vpnserver/BlockedIpStatList',
//   params,
//   sorter,
//   filter,);
// }

// export async function checkIpAreas(
//   params?: { [key: string]: any },
//   sorter?: { [key: string]: any },
//   filter?: { [key: string]: any },
// ) {
//   return req.postForm<API.VpnServerOnlineIpList>(
//     '/vpnserver/checkIpAreas',
//     params,
//     sorter,
//     filter,
//   );
// }


export async function syncIps() {
  return req.postForm<API.VpnServerSyncIpList>('/vpnserver/SyncIps');
}



